﻿<UserControl x:Class="SLAdmin.UserControls.EditSurveyPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:extended="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:liquid="clr-namespace:Liquid;assembly=Liquid"
    xmlns:images="clr-namespace:SLAdmin.Images"    
    xmlns:extensions="clr-namespace:SLExtensions.Controls;assembly=SLExtensions.Controls"    
    xmlns:common="clr-namespace:Common;assembly=Common"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
             LayoutUpdated="UserControl_LayoutUpdated">
    
    <Grid x:Name="LayoutRoot" Style="{StaticResource MainDockBackground2}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="100"/>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="50"/>
            </Grid.RowDefinitions>
        
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="130" />
                    <ColumnDefinition Width="1*"/>
                </Grid.ColumnDefinitions>
                <Image Grid.Column="0" Margin="5" Source="icons/surveypage_128.png" />
                <TextBox Grid.Column="1" Text="{Binding PageName, Mode=TwoWay}" Style="{StaticResource TextBoxMainHeadline}"/>
            </Grid>
            <Border Grid.Row="2" Style="{StaticResource BorderBottomPanel}">
                <Button x:Name="btnSave" 
                        Style="{StaticResource Button_Save}"                    
                        Click="btnSave_Click">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="icons/filesave-32.png"/>
                        <TextBlock Margin="5,0,0,0"
                               VerticalAlignment="Center" 
                               Text="Save"/> 
                            </StackPanel>
                </Button>
            </Border>
            <extended:TabControl Grid.Row="1" x:Name="CodeTabs" Background="White">
                <common:TabItem Header="DualView">
                
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="3*" />                            
                            <ColumnDefinition Width="3*"/>
                        </Grid.ColumnDefinitions> 
                        <ScrollViewer Grid.Column="0" Margin="0,0,5,0">
                        <TextBox AcceptsReturn="True" 
                             TextWrapping="Wrap"
                             TabIndex="1"
                             x:Name="rtCode"
                             Text="{Binding PageContent, Mode=TwoWay}"                             
                                 TextChanged="rtCode_TextChanged"
                             LostFocus="rtCode_LostFocus"
                             HorizontalAlignment="Stretch"                             
                             VerticalAlignment="Stretch"/>
                        </ScrollViewer>    
                        <extended:GridSplitter Width="5" Grid.Column="0" />
                        <ScrollViewer Grid.Column="1" HorizontalScrollBarVisibility="Auto"
                                      VerticalScrollBarVisibility="Visible">
                            <ContentControl Margin="5" x:Name="Xaml" />
                        </ScrollViewer>                            
                    </Grid>
                </common:TabItem>
                <common:TabItem Header="Full Preview">
                    <ScrollViewer Margin="5" Grid.Column="1" HorizontalScrollBarVisibility="Auto"
                                      VerticalScrollBarVisibility="Visible">
                        <ContentControl x:Name="Xaml2" Grid.Column="1"/>
                    </ScrollViewer>
                </common:TabItem>
                <common:TabItem Header="Full Code" >
                    <ScrollViewer>
                    <TextBox AcceptsReturn="True" 
                             TextWrapping="Wrap"
                             TabIndex="1"
                             x:Name="rtCode2"
                             Text="{Binding PageContent, Mode=TwoWay}"                             
                             TextChanged="rtCode_TextChanged"
                             LostFocus="rtCode_LostFocus"
                             HorizontalAlignment="Stretch"                             
                             VerticalAlignment="Stretch"/>
                   </ScrollViewer>
                </common:TabItem>
            </extended:TabControl>
       </Grid>
    </Grid>     
</UserControl>
